<?php

/**
 * This file is part of Webman AI.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 */

namespace plugin\ai\app\handler\driver;

use Throwable;

class ChatGlm extends Gpt
{

    /**
     * @var string api地址
     */
    protected $api = 'https://open.bigmodel.cn/api/paas/v4/';

    /**
     * @param array $data
     * @param array $options
     * @return void
     * @throws Throwable
     */
    public function completions(array $data, array $options)
    {
        $data['model'] = in_array($data['model'], ['chatglm', 'chatglm_pro']) ? 'glm-3-turbo' : $data['model'];
        return parent::completions($data, $options);
    }

}